<template>
	<view class="withdrawal-view">
		<view class="withdrawal-header">
			<!-- <view class="withdrawal-title">{{name}}</view> -->
			<!-- <view class="withdrawal-header-title">
				<text>可提现金额</text>
				<view class="header-eye-view">
					<u-icon v-if="eyeShow" name="eye-off" size="40rpx" style="margin-right: 30rpx;"
					@click="closeEye"></u-icon>
					<u-icon v-else name="eye-fill" size="40rpx" @click="openEye"></u-icon>
				</view>
			</view>
			<view class="withdrawal-header-desc" v-if="eyeShow">
				￥{{amount}}
			</view>
			<view class="withdrawal-header-desc" v-else>
				*****
			</view> -->
		</view>
		<view class="withdrawal-form">
			<view class="withdrawal-form-view">
				<view style="margin-bottom: 30rpx;margin-left: 20rpx;">充值金额</view>
				<view class="withdrawal-form-item">
					<input class="withdrawal-form-input" v-model="form.amount" type="number"
					placeholder="请输入充值金额" placeholder-style="font-size: 13px;color: #666666;margin-left:20rpx;">
					<!-- <text style="font-size: 12px;color: #C52B21;" @click="allAmount">全部提现</text> -->
				</view>
				<view class="order-pay-view">
					<view class="withdrawal-title-view">充值至</view>
					<view class="order-pay-view1">
						<view style="display: flex;flex-direction: column;">
							<view class="order-pay-imagea">
								<text style="margin:0 0rpx 10rpx 20rpx;font-size: 14px;">余额</text>
							</view>
							<!-- <view style="font-size: 10px; color: #C52B21;margin-left: 20rpx;">
								需先提现到余额
							</view> -->
						</view>
						<radio-group>
							<radio value="code" color="#C52B21" :checked="true" />
						</radio-group>
					</view>
				</view>
				<template>
					<icon-title color="#333333" comTitle="支付金额" desc></icon-title>
					<view class="order-payPrcie-tabs">
						<view class="order-payPrice-tabItem" v-for="(item,index) in priceList" :key="index"
						@click="getCheckTabIndex(index,item)" :class="tabIndex==index?'accent-Tabcolor':'bg-Tabcolor'">{{item.title}}</view>
					</view>
				</template>
			</view>
		</view>
		<view class="with-bottom-view">
			<view class="with-bottom-view1" @click="withdraw">
				确定
			</view>
			<!-- <view class="with-bottom-tip">每月20号免费提现</view> -->
		</view>
	</view>
</template>

<script>
	import iconTitle from "@/components/title/icon-title.vue"
	import LableInput from "@/components/form/labelInput.vue"
	export default {
		components:{
			LableInput,
			iconTitle
		},
		data(){
			return{
				form:{
					amount:'300',
				},
				amount:0,
				// radioValue:'wechart',
				eyeShow:true,
				priceList:[
					{title:'300'},
					{title:'500'},
					{title:'1000'},
					{title:'2000'},
					{title:'5000'},
				],
				tabIndex: 0,
			}
		},
		onLoad(option) {
			this.form.type = option.type
			this.amount = option.amount
		},
		methods:{
			getCheckTabIndex(index,item){
				this.tabIndex = index
				this.form.amount = item.title
			},
			// allAmount(){
			// 	this.form.amount = this.amount
			// },
			// radioChange(e){
			// 	this.radioValue = e.detail.value
			// 	if(this.radioValue == 'wechart'){
			// 		this.form.type = 1
			// 	}else if(this.radioValue == 'alipay'){
			// 		this.form.type = 2
			// 	}else{
			// 		this.form.type = 3
			// 	}
			// 	console.log(this.form.type)
			// },
			withdraw(){
				if(this.form.amount==0){
					return uni.showToast({
						title:'请填写金额',
						icon:"none"
					})
				}
				let form={
					order_type:2,
					type:4,
					amount:this.form.amount
				}
				this.$tools.reLaunch('/pages/pay/pay?form='+JSON.stringify(form))
				// if(!this.form.paypass){
				// 	return uni.showToast({
				// 		title:'请填写支付密码',
				// 		icon:"none"
				// 	})
				// }
				// this.$http.post(this.$api.withdrawal,this.form,{token:true}).then(res=>{
				// 	if(res.code==1){
				// 		uni.showToast({
				// 			title:'提现成功',
				// 			icon:"none"
				// 		})
				// 		setTimeout(function(){
				// 			uni.switchTab({
				// 				url:'/pages/index/index'
				// 			})
				// 		},500)
				// 	}else{
				// 		uni.showToast({
				// 			title:res.msg,
				// 			icon:"error"
				// 		})
				// 	}
				// })
			},
			closeEye(){
				this.eyeShow = false
			},
			openEye(){
				this.eyeShow = true
			}
		}
	}
</script>

<style lang="scss">
	// 金额切换
	.order-payPrcie-tabs {
		display: flex;
		flex-wrap: wrap;
		padding: 30rpx;
		// background-color: #FFE6E6;
		border-radius: 30rpx;
	
		.order-payPrice-tabItem:first-child {
			margin-left: 0;
		}
		.order-payPrice-tabItem:nth-child(4n) {
			margin:0rpx 0rpx 30rpx 0rpx;
		}
	
		.order-payPrice-tabItem {
			padding: 20rpx 30rpx;
			border-radius: 20rpx;
			font-size: 18px;
			font-weight: bold;
			display: flex;
			align-items: center;
			justify-content: center;
			width: 29%;
			margin:0rpx 0rpx 30rpx 30rpx;
		}
	
		.accent-Tabcolor {
			background-color: #fa3534;
			color: #ffffff;
		}
	
		.bg-Tabcolor {
			background-color: #ffffff;
			color: #333333;
		}
	}
	.pay-form-view{
		display: flex;
		align-items: center;
		padding-left: 40rpx;
		.pay-form-label{
			margin-right: 30rpx;
			flex-shrink: 0;
		}
	}
	.withdrawal-form-input{
		padding-left: 30rpx;
		font-size: 16px;
		font-weight: bold;
	}
	.with-bottom-tip{
		font-size: 14px;
		margin-top: 40rpx;
		color: #E83434;
	}
	.withdrawal-title{
		font-size: 18px;
		text-align: center;
		color: #ffffff;
		
	}
	.with-bottom-view{
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 100rpx;
		flex-direction: column;
		.with-bottom-view1{
			display: flex;
			align-items: center;
			justify-content: center;
			letter-spacing: 2rpx;
			width: 80%;
			padding: 20rpx 0;
			background: #C52B21;
			border-radius: 20rpx;
			font-size: 15px;
			color: #ffffff;
		}
	}
	.withdrawal-title-view{
		margin-bottom: 30rpx;
		font-size: 13px; 
		color: #333333;
	}
	.order-pay-view{
		background-color: #FFF6DE;
		border-radius: 20rpx;
		margin-top: 30rpx;
		padding-left: 20rpx;
	}
	.order-pay-view1{
		display: flex;
		// align-items: center;
		justify-content: space-between;
		margin-bottom: 30rpx;
	}
	.order-pay-image{
		width: 40rpx;
		height: 40rpx;
	}
	.order-pay-imagea{
		display: flex;
		align-items: center;
	}
	.price-btn{
		position: fixed;
		bottom: 0;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #ffffff;
		border-top-left-radius: 30rpx;
		border-top-right-radius: 30rpx;
		padding: 20rpx 30rpx;
	}
	.withdrawal-form{
		padding: 0 30rpx 30rpx 30rpx;
		.withdrawal-form-view{
			background-color: #FFF6DE;
			border-radius: 30rpx;
			padding: 30rpx;
			margin-top: -300rpx;
			.withdrawal-form-item{
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #e7e7e7;
				padding-bottom: 20rpx;
			}
		}
	}
	.withdrawal-view{
		background-color: #FFF0CA;
		height: 100vh;
		.withdrawal-header{
			height: 500rpx;
			background: url("../../../static/index/05.png") no-repeat;
			background-size: 100% 100%;
			color: #ffffff;
			padding: 30rpx 30rpx 130rpx 30rpx;
			.withdrawal-header-title{
				display: flex;
				align-items: center;
				margin-top: 140rpx;
				.header-eye-view{
					display: flex;
					align-items: center;
					margin-left: 100rpx;
				}
			}
			.withdrawal-header-desc{
				font-size: 20px;
				color: #ffffff;
				padding: 30rpx 0;
			}
		}
	}
</style>